import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'
import Layout from '../views/Layout/Layout.vue'
import login from '../views/login/login.vue'
//异步加载组件
const About = () => import('../views/AboutView.vue')

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'layout',
    component: Layout,
    children: [
      {
        path: '/',
        name: 'home',
        component: HomeView
      },
      {
        path: '/about',
        name: 'about',
        component:About
      }
    ]
  },
  {
    path: '/login',
    name: 'login',
    component: login
  }
 
]

const router = new VueRouter({
  mode: 'history',
  // base: process.env.BASE_URL,
  routes
})

export default router
